import request from "@/utils/request";




enum COLLECT {
    COLLECT_LIST = "/collect",
    COLLECT_GETONE = '/collect/getone',
    USERCOLLECT = '/collect/user/collect'
}


export const toCollect = (data: { user_id: string, food_id: string }) => request({
    method: "POST",
    url: COLLECT.COLLECT_LIST,
    data
})

export const cancelCollect = (data: { user_id: string, food_id: string }) => request({
    method: "DELETE",
    url: COLLECT.COLLECT_LIST,
    data
})


export const getone = (data: { user_id: string, food_id: string }) => request({
    method: "POST",
    url: COLLECT.COLLECT_GETONE,
    data
})

export const Getall = (user_id: string, skip = 0) => request({
    method: "GET",
    url: COLLECT.COLLECT_LIST + '/list' + `/${user_id}/${skip}`,
})


//获取收藏和文章
export const UserGet = (id: string) => request({
    method: "GET",
    url: COLLECT.USERCOLLECT + `/${id}`
})